package com.extension.company.view.my.localorder.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.extension.company.admin.R;
import com.extension.company.model.entity.SameCityOrderAllBean;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * 同城订单 -- 退款/退货
 */
public class LocalCityQuiteMoneyAdapter extends RecyclerView.Adapter<LocalCityQuiteMoneyAdapter.ViewHolder> {


	private List<SameCityOrderAllBean> mValues;
	private Context context;

	public LocalCityQuiteMoneyAdapter(Context context, List<SameCityOrderAllBean> items) {
		this.mValues = items;
		this.context = context;
	}

	@Override
	public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
		View view = LayoutInflater.from(parent.getContext())
				.inflate(R.layout.fragment_fragmentquitemoney, parent, false);
		return new ViewHolder(view);
	}

	@Override
	public void onBindViewHolder(final ViewHolder holder, final int position) {

		holder.quiteMoneyItemRight.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if (null != click) {

				}
			}
		});

		holder.itemView.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if (null != click) {
					click.onItemClick(position);
				}
			}
		});
	}

	@Override
	public int getItemCount() {
		return 8;
	}

	public class ViewHolder extends RecyclerView.ViewHolder {

		@BindView(R.id.quite_money_item_icon)
		ImageView quiteMoneyItemIcon;
		@BindView(R.id.quite_money_store_name)
		TextView quiteMoneyStoreName;
		@BindView(R.id.quite_money_item_img)
		ImageView quiteMoneyItemImg;
		@BindView(R.id.quite_money_item_title)
		TextView quiteMoneyItemTitle;
		@BindView(R.id.quite_money_item_total_num)
		TextView quiteMoneyItemTotalNum;
		@BindView(R.id.quite_money_item_total_price)
		TextView quiteMoneyItemTotalPrice;
		@BindView(R.id.quite_money_item_right)
		Button quiteMoneyItemRight;

		public ViewHolder(View view) {
			super(view);
			ButterKnife.bind(this, view);
		}

	}

	public interface OnListFragmentInteractionListener {
		void onListFragmentInteraction();

		void onItemClick(int position);
	}

	private OnListFragmentInteractionListener click;

	public void setAdapterClick(OnListFragmentInteractionListener click) {
		this.click = click;
	}
}
